/*
 * Inst.java
 * Copyright (C) 12/29/2005, 22:53 Francisco J. Hernández
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 */

package Sindarin.Common;

/**
 *
 * @author Francisco J. Hernández
 */
public class Inst {
    
    public final static int LOADC = 0;
    public final static int LOAD = 1 + LOADC;
    public final static int STORE = 1 + LOAD;
    public final static int INC = 1 + STORE;
    public final static int DEC = 1 + INC;
    public final static int DUP = 1 + DEC;
    public final static int MULC = 1 + DUP;
    public final static int JUMP = 1 + MULC;
    public final static int JUMPZ = 1 + JUMP;    
    public final static int WAIT = 1 + JUMPZ;
    public final static int MOUSEMOVE = 1 + WAIT;
    public final static int MOUSEPRESS = 1 + MOUSEMOVE;
    public final static int MOUSERELEASE = 1 + MOUSEPRESS;
    public final static int KEYPRESS = 1 + MOUSERELEASE;
    public final static int KEYRELEASE = 1 + KEYPRESS;
    public final static int SAY = 1 + KEYRELEASE;
    public final static int EXIT = 1 + SAY;
    public final static int POP = 1 + EXIT;
    public final static int IODELAY = 1 + POP;
    public final static int LOADDELAY = 1 + IODELAY;
    public final static int GETCOLOR = 1 + LOADDELAY;
    public final static int CMP = 1 + GETCOLOR;
    public final static int ALU = 1 + CMP;
    public final static int CALLSUB = 1 + ALU;
    public final static int RETURN = 1 + CALLSUB;
    public final static int LOADNATIVEMODE = 1 + RETURN;
    public final static int PRINT = 1 + LOADNATIVEMODE;
    public final static int LOADDATE = 1 + PRINT;
    public final static int LOADTIME = 1 + LOADDATE;
    public final static int BEEP = 1 + LOADTIME;
    public final static int GETCOMPONENT = 1 + BEEP;
    
    public final static String []NMONICOS = {   "loadc",
                                                "load",
                                                "store",
                                                "inc",
                                                "dec",
                                                "dup",
                                                "mulc",
                                                "jump",
                                                "jumpz",
                                                "wait",
                                                "mousemove",
                                                "mousepress",
                                                "mouserelease",
                                                "keypress",
                                                "keyrelease",
                                                "say",
                                                "exit",
                                                "pop",
                                                "iodelay",
                                                "loaddelay",
                                                "getcolor",
                                                "cmp",
                                                "alu",
                                                "callsub",
                                                "return",
                                                "loadnativemode",
                                                "print",
                                                "loaddate",
                                                "loadtime",
                                                "beep",
                                                "getcomponent"
                                             };
    
    public int opcode;
    public Object operador;
    
    /** Creates a new instance of Inst */
    public Inst(int opcode, Object operador) {
        this.opcode = opcode;
        this.operador = operador;
    }
    
    public String toString() {
        return "Opcode: " + NMONICOS[opcode] + ", operador: " + operador;
    }   
}